﻿@model IEnumerable<Comment>
@{
    ViewData["Title"] = "评论管理";
}
@section PYhead{
    <link href="~/css/Account.css" type="text/css" rel="stylesheet">
    <link href="~/css/user-admin.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="~/js/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="~/js/jquery-ui.min.js"></script>

    <style>
        table {
            border-collapse: collapse;
            margin: 0 auto;
            text-align: center;
            width: 100%;
        }

            table td,
            table th {
                width: 117px;
                height: 45px;
                font-size: 10px;
                text-align: center;
                color: #666;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
            }

            table thead th {
                background-color: #CCE8EB;
                width: 100px;
            }

            table tr {
                background: #fff;
                box-shadow: 0px 0px 1px gray;
            }

                table tr td a {
                    color: rgb(0, 174, 255);
                    cursor: pointer;
                }

        #Editor {
            width: 400px;
            position: fixed;
            box-shadow: 0 0 1px gray;
            background-color: white;
            left: calc(50% - 200px);
            top: calc(50% - 250px);
            display: none;
        }

            #Editor p {
                float: right;
                margin-right: 50px;
                color: rgb(0, 174, 255);
                cursor: pointer;
            }

        label {
            display: inline-block;
            margin-left: 20px;
            width: 50px;
        }

        .select {
            margin-left: 20px;
            margin-top: 25px;
            font-size: 15px;
            width: 255px;
            height: 45px;
            text-align: center;
            text-indent: 100px;
            border-radius: 8px;
        }

            .select option {
                padding-top: 5px;
                padding-bottom: 5px;
                height: 45px;
                font-size: 15px;
            }

        body {
            min-width: 800px;
        }
    </style>
}
<table class="table">
    <tr>
        <th>CID</th>
        <th>目标文章</th>
        <th>指向CID</th>
        <th>评论人</th>
        <th>类型</th>
        <th>内容</th>
        <th>点赞数</th>
        <th>操作</th>
    </tr>
    @foreach (var u in Model)
    {
        <tr>
            <td>@u.CId</td>
            <td>@u.AId</td>
            <td>@u.TargetId</td>
            <td>@u.UName</td>
            <td>@u.Type</td>
            <td>@u.Content</td>
            <td>@u.LikeNumber</td>
            <td><a onclick="ConfirmDel(@u.CId)">删除</a></td>
        </tr>
    }
</table>
<script>
    function ConfirmDel(id) {
        var a = confirm("确认删除？（操作不可逆）");
        if (a == true) {
            $.ajax({
                url: "/AcMana/CommentDelete",
                async: false,
                type: "post",
                data: {
                    Id: id
                },
                dataType: "text",
                success: function (response) {
                    response = JSON.parse(response);
                    alert(response);
                    window.location.reload();
                }
            });
        } else {
            return;
        }
    }
</script>
